<?php
include '../mysqladmin.php';
$strName = $_POST["account"];
$strPassword = $_POST["pass"];
$sql = "SELECT * FROM admin WHERE account='{$strName}'";
$result = mysqli_query($link, $sql);
if (!$result->num_rows) {
  $code["msg"] = "找不到该用户";
  $res = json_encode($code); 
  echo $res;
} else {
  $row = $result->fetch_array();
  if($strPassword == $row['password']){
    $code["status"] = true;
    $code["msg"] = "登陆成功";
    $res = json_encode($code); 
    echo $res;
  }else{
    $code["msg"] = "密码错误！";
    $res = json_encode($code); 
    echo $res;
  }
}

//mysqli_free_result($result);
mysqli_close($link);
?>
